package routers

import (
	"mini-app/internal/app/web/controller"
	"mini-app/internal/app/web/middleware"

	"github.com/gin-gonic/gin"
)

// webGroup 小程序前端路由
func webGroup(router *gin.RouterGroup) {
	// 临时测试
	{
		router.GET("/express-fee", controller.Index{}.ExpressFee)
	}
	{
		router.GET("/user/login", controller.User{}.Login)                                // 登录授权
		router.GET("/location/info", controller.Location{}.LocationInfo)                  // 位置信息
		router.POST("/location/neighbor-robots", controller.Location{}.GetNeighborRobots) // 获取最近位置
		router.POST("/get-qrcode", controller.Index{}.GetQrCode)                          // 获取二维码
		router.POST("/upload/file-upload", controller.Index{}.FileUpload)                 // 文件上传
		router.POST("/pay/wechat-v3-notify", controller.Index{}.WechatV3Notify)           // 微信支付回调
	}
	// 商品
	{
		router.GET("/goods/list", controller.Goods{}.List)                         // 商品列表
		router.GET("/goods/detail", controller.Goods{}.Detail)                     // 商品详情
		router.GET("/goods/class/list", controller.Goods{}.ClassList)              // 商品分类
		router.GET("/goods/tag/list", controller.Goods{}.TagList)                  // 商品标签
		router.GET("/goods/corner-label/list", controller.Goods{}.CornerLabelList) // 商品脚标
		router.GET("/goods/pickup-type/list", controller.Goods{}.PickupTypeList)   // 取货方式
		router.GET("/goods/review", controller.Goods{}.Review)                     // 商品评论
		router.GET("/goods/latest-order", controller.Goods{}.LatestOrder)          // 最近购买记录
	}
	// 在线活动
	{
		router.GET("/online-event/list", controller.OnlineEvent{}.List)                    // 活动列表
		router.GET("/online-event/support-detail", controller.OnlineEvent{}.SupportDetail) // 助力详情
	}
	// 公告
	{
		router.GET("/announcement/list", controller.Announcement{}.List) //公告列表
	}
	// 评测
	{
		router.GET("/goods-review/nearby-reviews", controller.GoodsReview{}.NearbyReviews) // 附近的评测
	}
	// banner
	{
		router.GET("/banner/detail", controller.Banner{}.Detail)
		router.GET("/banner/list", controller.Banner{}.List)
	}
	//登录验证
	{
		router.Use(middleware.LoginCheck())
		router.GET("/user/logout", controller.User{}.Logout)                                    // 登录退出
		router.GET("/user/del", controller.User{}.Del)                                          // 账号注销
		router.GET("/wanxiang/login", controller.Index{}.WanxiangLogin)                         // 判断万象是否登录
		router.GET("/oauth/callback", controller.Index{}.OauthCallback)                         // 万象小程序回调
		router.GET("/points/get-wanxiang-member", controller.User{}.GetWanXiangMember)          // 万象用户信息
		router.GET("/points/get-wanxiang-points", controller.User{}.GetWanXiangPoints)          // 万象积分信息
		router.POST("/points/reverse-wanxiang-points", controller.User{}.ReverseWanXiangPoints) // 万象积分回退
		router.POST("/coupon/check-code", controller.Coupon{}.CheckCode)                        // 取货码校验
	}
	// 用户信息
	{
		router.GET("/user/get-phone-number", controller.User{}.GetPhoneNumber) // 获取手机号
		router.GET("/user/profile", controller.User{}.Profile)                 // 用户信息
		router.POST("/user/save", controller.User{}.Save)                      // 用户信息编辑
	}
	// 在线活动
	{
		router.POST("/online-event/support", controller.OnlineEvent{}.Support) // 助力
	}

	// 手机号验证
	{
		router.Use(middleware.PhoneCheck())
		router.POST("/sa-order/cart-goods", controller.Order{}.SaCartGoods)     // 零售:获取购物车信息
		router.POST("/sa-order/wechat-jspay", controller.Order{}.SaWechatJSPay) // 零售:微信支付
	}
	// 购物车
	{
		router.POST("/shopping-cart/save", controller.ShoppingCart{}.Save) // 购物车保存
		router.POST("/shopping-cart/list", controller.ShoppingCart{}.List) // 购物车列表
	}

	// 订单
	{
		router.POST("/order/create-order", controller.Order{}.CreateOrder)              // 创单
		router.POST("/order/redeem-order", controller.Order{}.RedeemOrder)              // 兑换订单(使用兑换码)
		router.POST("/order/order-list", controller.Order{}.OrderList)                  // 订单列表
		router.POST("/order/order-detail", controller.Order{}.OrderDetail)              // 订单详情
		router.POST("/order/pickup-orders", controller.Order{}.PickupOrders)            // 取货订单列表
		router.POST("/order/pickup-order-detail", controller.Order{}.PickupOrderDetail) // 取货订单详情
		router.POST("/order/pickup", controller.Order{}.Pickup)                         // 取货
		router.POST("/order/wechat-jspay", controller.Order{}.WechatJSPay)              // 微信支付
		router.GET("/order/status-statistics", controller.Order{}.StatusStatistics)     // 订单状态统计
		router.GET("/order/shipment-info", controller.Order{}.ShipmentInfo)             // 物流信息
		router.GET("/order/shipping-tracking", controller.Order{}.ShippingTracking)     // 物流轨迹
		router.GET("/order/express-fee", controller.Order{}.GetExpressFee)              // 获取运费
	}
	// 在线活动
	{
		router.GET("/online-event/detail", controller.OnlineEvent{}.Detail)          // 活动详情
		router.POST("/online-event/join", controller.OnlineEvent{}.Join)             // 参加活动
		router.GET("/online-event/winner/list", controller.OnlineEvent{}.WinnerList) // 中奖名单
	}
	// 收货地址
	{
		router.POST("/user-address/create", controller.UserAddress{}.Create)          // 新增收货地址
		router.POST("/user-address/delete", controller.UserAddress{}.Delete)          // 删除收货地址
		router.POST("/user-address/update", controller.UserAddress{}.Update)          // 更新收货地址
		router.GET("/user-address/list", controller.UserAddress{}.List)               // 收货地址列表
		router.POST("/user-address/set-default", controller.UserAddress{}.SetDefault) // 设置默认收货地址
	}
	// 评测
	{
		router.GET("/goods-review/list", controller.GoodsReview{}.List)      // 评测列表 1-已评测 2-待评测
		router.POST("/goods-review/create", controller.GoodsReview{}.Create) // 新增评测
		router.POST("/goods-review/update", controller.GoodsReview{}.Update) // 更新评测
		router.GET("/goods-review/detail", controller.GoodsReview{}.Detail)  // 评测详情
	}

}
